package android.demo.activity.list;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import android.demo.BaseActivity;
import android.demo.R;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.SimpleAdapter;

public class ListActivityC extends BaseActivity {

    @Override
    public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        ListView listView = new ListView(this);
        SimpleAdapter adapter = new SimpleAdapter(this, getData(), R.layout.simple_adapter,
                new String[] {"title", "info", "img"},
                new int[] {R.id.title, R.id.info, R.id.img});
        listView.setAdapter(adapter);
        setContentView(listView);
    }
    
    private List<Map<String, Object>> getData() {
        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
 
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("title", "G1");
        map.put("info", "google 1");
        map.put("img", R.drawable.icon);
        list.add(map);
 
        map = new HashMap<String, Object>();
        map.put("title", "G2");
        map.put("info", "google 2");
        map.put("img", R.drawable.icon);
        list.add(map);
 
        map = new HashMap<String, Object>();
        map.put("title", "G3");
        map.put("info", "google 3");
        map.put("img", R.drawable.icon);
        list.add(map);
         
        return list;
    }
}
